import React, { useState } from 'react';
import DescriptionsCondition from '@/components/DescriptionsCondition';
import DrawerCondition from '@/components/DrawerCondition';
import { userObj } from '@/common/contact';
const PointDetail = (props) => {
  const { dispatch, visible = {}, onClose, handleCallback, loading } = props;
  const { detail = {}, show } = visible;
  const { username, answer = '{}' } = detail
  const data = JSON.parse(answer)
  const formItems = Object.keys(data).map(item => {
    return {
      label: userObj[item] ? userObj[item] : [item],
      name: [item]
    }
  })

  const modalProps = {
    title: `${username}问卷详情`,
    visible: show,
    onClose,
  };
  return (
    <DrawerCondition {...modalProps}>
      <DescriptionsCondition formItems={formItems} initialValues={data}></DescriptionsCondition>
    </DrawerCondition>
  );
};
export default PointDetail;
